home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
AMIGA
/
(A)G
/
(A)G2.ADF
/
Othello
/
OthHelp.c
< prev
next >
Wrap
C/C++ Source or Header
|
1988-12-01
|
10KB
|
275 lines
/********************** Othello Source File #2 *********************
----------------------
*******************************************************************
* *
* procedure name: info_display *
* *
* referenced by: othello *
* *
* includes: othmenu.h *
* *
*******************************************************************/
#include <exec/types.h>
#include <lattice/stdio.h>
#include <intuition/intuition.h>
#include "othmenu.h"
#define LINEHEIGHT 8
extern USHORT *ourpointer;
extern struct TextAttr smallfont;
struct IntuiText string =
{
1, 0, /* frontpen, backpen */
JAM2, /* drawmode */
0,0, /* leftedge, topedge */
&smallfont, /* pointer to font */
NULL, /* pointer to text data */
NULL /* next text */
};
struct Window *info_window;
short info_xoff, info_yoff;
struct NewWindow nwi =
{
10,10,
324,180,
-1,-1,
MOUSEBUTTONS,
NOCAREREFRESH | WINDOWDRAG | SMART_REFRESH | ACTIVATE,
NULL,
NULL,
(UBYTE *)"CSOthello Online Help!",
NULL,
NULL,
300,180,
300,180,
WBENCHSCREEN
};
BOOL info_display(menu,item,subitem)
int menu, item, subitem;
{
char *text[20];
USHORT numpages, page, line;
UBYTE *blank = " ";
if (!(info_window = (struct Window *)OpenWindow(&nwi) ))
{
printf("Can't open info_window!\n");
return(FALSE);
}
info_xoff = info_window->BorderLeft;
info_yoff = info_window->BorderTop;
if (ourpointer)
SetPointer(info_window,ourpointer,POINTERHEIGHT,POINTERWIDTH,POINTERXOFF,POINTERYOFF);
page = numpages = 0;
do
{
for (line = 0; line < 20; line++)
text[line] = NULL;
numpages = 1;
switch (menu)
{
case PROJECT :
switch (item)
{
case NEWGAME :
text[00] = "This function starts the game over";
text[01] = "with the first turn going to the";
text[02] = "appropriate player.";
break;
case BOARDSIZE :
text[00] = "These functions set the size of the";
text[01] = "board. The standard size is an eight";
text[02] = "by eight board. Larger boards can";
text[03] = "take rather a long time to complete.";
text[04] = "Changing the size of the board";
text[05] = "restarts the game.";
break;
case OPEN :
text[00] = "This function is used to reload a";
text[01] = "saved game.";
break;
case SAVEGAME :
text[00] = "This function saves the current status";
text[01] = "of a game so that it can be resumed.";
text[02] = "To resume a stored game, use OPEN to";
text[03] = "reload it.";
break;
case SAVEDEF :
text[00] = "This function saves a file that";
text[01] = "stores the desired initial setup of";
text[02] = "the game. It stores the board size,";
text[03] = "the difficulty levels of each player";
text[04] = "and whether or not the game is in";
text[05] = "STEPTHROUGH or RACETHROUGH mode.";
text[06] = "This file is saved under the name";
text[07] = "othello.def and is automatically";
text[08] = "loaded whenever the game is run if it";
text[09] = "is in the current directory.";
break;
case ABOUT :
text[00] = " This program was written by:";
text[02] = " ** CygnusSoft **";
text[04] = " Copyright 1986, CygnusSoft";
text[05] = "This program is public domain and";
text[06] = "may be freely distributed for no";
text[07] = "charge. The source is also public";
text[08] = "domain and any improvements are";
text[09] = "encouraged as long as the above notice";
text[10] = "is retained.";
text[12] = "Please address any correspondence to:";
text[14] = "CygnusSoft";
text[15] = "407-1280 Haro St,";
text[16] = "Vancouver, BC";
text[17] = "Canada";
text[18] = "V6E1E8";
break;
case HELP :
switch (subitem)
{
case FUNCTION :
text[00] = "This is the function you're using";
text[01] = "right now. Use it to get help on all";
text[02] = "the menu options available.";
break;
case ALL :
text[00] = "Othello, by CygnusSoft, is a game";
text[01] = "of skill where each move can have";
text[02] = "effects that last the rest of the";
text[03] = "game. The two players take turns";
text[04] = "placing pieces on the board. You flip";
text[05] = "over your opponents pieces by trapping";
text[06] = "one or more rows, columns or diagonals";
text[07] = "of your opponents pieces between the";
text[08] = "piece that you play and pieces of your";
text[09] = "color already on the board. Each time";
text[10] = "you make a move you must flip over at";
text[11] = "least one of your opponents pieces.";
text[12] = "Whoever has the most pieces when the";
text[13] = "board is full, or when neither player";
text[14] = "can move, is the winner.";
break;
}
break;
case QUIT :
text[00] = "This function quits the program";
text[01] = "completely. It is the same as";
text[02] = "selecting the close window gadget.";
break;
}
break;
case PLAYER1 :
case PLAYER2 :
text[00] = "These functions set the difficulty";
text[01] = "level. On level four the computer may";
text[02] = "have to think for about half a minute,";
text[03] = "so be patient. 'Human', of course,";
text[04] = "means that a human player ( you! ) is";
text[05] = "controlling that player. Simply tap";
text[06] = "with the left mouse button in the";
text[07] = "square you'd like to make your move";
text[08] = "in. If it's a legal move, the computer";
text[09] = "will flip over all the pieces that";
text[10] = "should be flipped. If it is not a";
text[11] = "legal move, you'll be told.";
text[13] = "If you are not very good at Othello,";
text[14] = "set your opponents difficulty level";
text[15] = "to 'Not good', 'Bad', 'Worse' or";
text[16] = "hopeless. This will give it a";
text[17] = "stupidity level of 1-4.";
break;
case GURUVSGURU :
text[00] = "If the computer is playing against";
text[01] = "itself these two choices set whether";
text[02] = "or not the program waits for the user";
text[03] = "to tap the screen with the left mouse";
text[04] = "button before going on to the next";
text[05] = "move. In STEPTHROUGH mode you must";
text[06] = "tap the screen after each turn, in";
text[07] = "RACETHROUGH mode the program never";
text[08] = "stops.";
break;
case OTHER :
switch (item)
{
case MOVES :
text[00] = "This function displays all the moves";
text[01] = "available to the current player.";
break;
case SUGGEST :
text[00] = "This function displays the move that";
text[01] = "the computer thinks would be best for";
text[02] = "the current player to make. The";
text[03] = "computer does it's thinking at the";
text[04] = "level three intelligence level.";
break;
}
break;
}
if (text[0] == NULL)
text[0] = "No information available!";
for (line = 0; line < 20; line++)
if (text[line])
printline(text[line], line);
waitformouseclick(info_window);
page++;
if (page < numpages)
for (line = 0; line < 20; line++) /* clear window */
printline(blank, line);
} while (page < numpages);
CloseWindow(info_window);
}
waitformouseclick(info_window)
struct Window *info_window;
{
struct IntuiMessage *message;
ULONG class;
USHORT code;
do
{
WaitPort(info_window->UserPort);
message = (struct IntuiMessage *)GetMsg(info_window->UserPort);
class = message->Class;
code = message->Code;
ReplyMsg(message);
} while ((class != MOUSEBUTTONS) || (code != SELECTUP));
}
printline(text, y)
char *text;
short y;
{
string.IText = text;
PrintIText(info_window->RPort, &string, info_xoff, info_yoff + y *LINEHEIGHT);
}
/*************** End of file. ******************/